<?php


$login = $_POST["login"];
$password = $_POST["password"];

if ((!$login) || (!$password)) {
	
	header("Location: index.php?page=login&state=error");	
}

else {
	
	 $loginState = login($login,$password);
	 if ($loginState) {	 	
	 	$_SESSION["login"] = $login;
	 	header("Location: index.php?page=admin");	 	 	
	 }
	 else
	 	header("Location: index.php?page=login&state=error");
	
}

?>